export function loading(loading, errorCb = Function.prototype) {
  return function (target, name, descriptor) {
    const oldFn = descriptor.value;
    descriptor.value = async function (...args) {
      try {
        this[loading] = true;
        await oldFn.apply(this, args);
      } catch (error) {
        console.error(`${name}-----start-----${error}`)
        // globalError(`${name}-----start-----${error}`);
        // globalLog(error);
        // globalError(`${name}-----end-----${error}`);
        errorCb.call(this, error, this);
      } finally {
        this[loading] = false;
      }
    };
  };
}